package com.tust.app.controller;

import com.tust.app.dao.NewsMapper;
import com.tust.app.domain.News;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class IndexController {
    //获取NewsMapper对象
    @Autowired
    private NewsMapper newsMapper;
    //http://localhost:8080/course/test
    @RequestMapping("test")
    public String index() throws Exception{
        List<News> news=newsMapper.selectAllNews();
        System.out.println(news);
        return "index";//返回试图文件名称
    }
}
